home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1989 April
/
1989-04.d64
/
golf handicap
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
50 lines
5 print"[147]":poke53281,6:poke53280,14:poke646,14
10 dim s(20),l(12):cr=68:print"[147]golf handicap calculator"
20 input"enter player's name";pn$:if pn$="" then print"[145][145]";:goto20
30 f$=left$(pn$,12)+".dat"
40 open 2,8,2,f$:open15,8,15:input#15,a$,b$:close15
50 if a$="62" then close2:gosub340:goto100
60 close2:open 2,8,2,f$:vm=20.1
70 for i=1 to 20:input#2,s(i):if s(i)<0 then vm=i:i=20
80 next i:close2:if vm=20.1 then vm=20:for i=0 to 19:s(i)=s(i+1):next
90 input"enter new score";s(vm):if vm<20 then s(vm+1)=-1
100 q=1:l(1)=s(1):qm=11:if vm<qm then qm=vm
110 for i=2 to vm
120 for j=1 to q
130 if s(i)<l(j) then for k=q to j step-1:l(k+1)=l(k):next:l(j)=s(i):j=q+10
140 next j:q=q+1:if q>qm then q=qm
150 if j<=q then l(q)=s(i)
160 next i
170 if vm=20 then print"the last twenty scores:":goto190
180 print""vm"scores:"
190 fori=1 to vm:prints(i);"[157]";:if i=10 then print
200 next:print
210 t=0:print"low scores used in computation:"
220 if vm<5 then print"5 or more scores needed for handicap.":goto280
230 if vm<17 then m%=1+(vm-5)/2
240 if vm>16 then m%=vm-10
250 for i=1 to m%:print l(i)"[157]";:t=t+l(i)-cr:next:t=t/m%*10:h=int(t*.096+.5)
260 print:print"handicap:";:ifh<0thenprint" +";
270 printabs(h)
280 print"save to disk (y/n)?":gosub460
290 if r=0 then330
300 open 15,8,15:print#15,"s0:";f$:close15
310 open 2,8,1,f$
320 for i=1 to vm:print#2,s(i):next:print#2,-1:close2
330 end
340 print"a new player"
350 print"enter "pn$"'s last twenty scores"
360 print"if you don't have 20, enter -1 after last score"
370 for v=1 to 20:input s(v)
380 vm=v:if s(v)=-1 then vm=v-1:v=20
390 next
400 print"[147]"pn$"'s last"vm"scores:"
410 for i=1 to vm:print "#"i" score"s(i):next
420 print"are these scores okay (y/n)?":gosub460
430 if r then return
440 input"enter # of bad score";n:if n<1 or n>vm then print"[145]";:goto440
450 print"correct #";n;:input s(n):goto400
460 geta$:if a$="y" then r=1:return
470 if a$="n" then r=0:return
480 goto460